#ifndef BATCHDATA_H
#define BATCHDATA_H

#include <QAbstractListModel>
#include <QObject>

class BatchData : public QAbstractListModel
{
    Q_OBJECT
public:
    // Q_PROPERTY(QString BatchDataNo READ BatchDataNo WRITE setBatchDataNo  NOTIFY signalBatchDataNoChanged)
public:
    explicit BatchData(QObject *parent = nullptr);
    // Q_INVOKABLE bool addBatchData(QString product, QString workShop);
    // Q_INVOKABLE bool updateBatchData(QString desc);
    // Q_INVOKABLE QVariantMap get(int row) const;
    Q_INVOKABLE bool loadBatchData(const QString& beginTime, const QString& endTime);

public:
    int rowCount(const QModelIndex &parent = QModelIndex()) const override;
    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
    QHash<int, QByteArray> roleNames() const override;

// signals:
//     void signalBatchDataNoChanged();
// public:
//     QString BatchDataNo();
//     void setBatchDataNo(QString BatchDataNo);


private:
    // QString m_batchNo;
    // QString m_product;
    // QString m_workShop;
    QHash<int, QByteArray> m_roles;
    QList<QHash<QString,QVariant>> m_records;
};

#endif // BATCHDATA_H
